package com.work.vo.main;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import com.work.utils.BigDecimalSerializer;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springblade.core.tool.utils.Func;

import java.math.BigDecimal;

/**
 * 货物库存汇总统计-船名详情VO
 *
 * @author ：dujianyu
 * @since ：Created in 2024/7/8 15:02
 */
@Data
public class StorageByShipDetailVO {

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "sbsID",notes = "")
    private Long id ;

    @JsonSerialize(using = ToStringSerializer.class)
    @ApiModelProperty(name = "舱单ID",notes = "")
    private Long transportBillId ;

    @ApiModelProperty(value = "单号")
    private String billNo;

    @ApiModelProperty(value = "货名")
    private String billCargoTypeName;

    @ApiModelProperty(value = "货主")
    private String cargoOwnerName;

    @ApiModelProperty(value = "货代")
    private String cargoAgentName;

    @ApiModelProperty(value = "件数")
    private Integer piece;

    @JsonSerialize(using = BigDecimalSerializer.class)
    @ApiModelProperty(value = "吨数")
    private BigDecimal ton;

    @ApiModelProperty(value = "件吨")
    private String pieceTonInfo;

    public String getPieceTonInfo() {
        if (Func.isNull(piece) || Func.isNull(ton)) {
            return "";
        }
        return piece + "/" + ton.stripTrailingZeros().toPlainString();
    }

    @ApiModelProperty(value = "货场")
    private String positionName;

    @ApiModelProperty(value = "货位")
    private String spot;

}
